import request from '@/utils/request'

export const getMiniAppList = (params) => {
    return request({
        url: "/admin/applet/index",
        method: "get",
        params: { ...params },
    });
};

/** 商家 */
export function merchantList(query = {}) {
    return request({
        url: 'admin/merchant/index',
        method: 'get',
        params: query
    })
}
export function merchantAdd(data) {
    return request({
        url: 'admin/merchant/add',
        method: 'post',
        data
    })
}
export function merchantEdit(data) {
    return request({
        url: 'admin/merchant/edit',
        method: 'post',
        data
    })
}

export function merchantDelete(data) {
    return request({
        url: 'admin/merchant/delete',
        method: 'post',
        data
    })
}
export function copyMerchant(data) {
    return request({
        url: 'admin/merchant/copyMerchant',
        method: 'post',
        data
    })
}
export function getMerchantAdmins(query = {}) {
    return request({
        url: 'admin/merchant/getAdmins',
        method: 'get',
        params: query
    })
}
export function merchantBindAdmin(data) {
    return request({
        url: 'admin/merchant/bindAdmin',
        method: 'post',
        data
    })
}
export function merchantunBindAdmin(data) {
    return request({
        url: 'admin/merchant/unbindAdmin',
        method: 'post',
        data
    })
}



/** 商品 */

export function goodsList(query = {}) {
    return request({
        url: 'admin/goods/index',
        method: 'get',
        params: query
    })
}
export function goodsAdd(data) {
    return request({
        url: 'admin/goods/add',
        method: 'post',
        data
    })
}
export function goodsEdit(data) {
    return request({
        url: 'admin/goods/edit',
        method: 'post',
        data
    })
}
export function goodsDel(data) {
    return request({
        url: 'admin/goods/delete',
        method: 'post',
        data
    })
}
export function getGoodsDetails(query) {
    return request({
        url: 'admin/goods/detail',
        method: 'get',
        params: query
    })
}
export function batchChangeStatus(data) {
    return request({
        url: 'admin/goods/batchChangeStatus',
        method: 'post',
        data
    })
}

/** 商品分类 */
export function goodsCategoryList(query = {}) {
    return request({
        url: 'admin/goods_category/index',
        method: 'get',
        params: query
    })
}

export function goodsCategoryAdd(data) {
    return request({
        url: 'admin/goods_category/add',
        method: 'post',
        data
    })
}
export function goodsCategoryEdit(data) {
    return request({
        url: 'admin/goods_category/edit',
        method: 'post',
        data
    })
}

export function goodsCategoryDelete(data) {
    return request({
        url: 'admin/goods_category/delete',
        method: 'post',
        data
    })
}

/** 优惠券 */
export function couponList(query = {}) {
    return request({
        url: 'admin/coupon/index',
        method: 'get',
        params: query
    })
}

export function couponAdd(data) {
    return request({
        url: 'admin/coupon/add',
        method: 'post',
        data
    })
}
export function couponEdit(data) {
    return request({
        url: 'admin/coupon/edit',
        method: 'post',
        data
    })
}

export function couponDelete(data) {
    return request({
        url: 'admin/coupon/delete',
        method: 'post',
        data
    })
}
export function couponUserList(query = {}) {
    return request({
        url: 'admin/coupon/userList',
        method: 'get',
        params: query
    })
}

// 获取商户分类
export function getMerchantCategoryList(query = {}) {
    return request({
        url: 'admin/merchant_category/index',
        method: 'get',
        params: query
    })
}

export function merchantCategoryDel(data) {
    return request({
        url: 'admin/merchant_category/delete',
        method: 'post',
        data
    })
}

export function merchantCategoryAdd(data) {
    return request({
        url: 'admin/merchant_category/add',
        method: 'post',
        data
    })
}

export function merchantCategoryEdit(data) {
    return request({
        url: 'admin/merchant_category/edit',
        method: 'post',
        data
    })
}
// 查看分类下的商户
export function getMerchantCategoryMerchantsList(query = {}) {
    return request({
        url: 'admin/merchant_category/getMerchants',
        method: 'get',
        params: query
    })
}

